from police import Police
from timo import Timo


class Hero_factory():
    def create_hero(self,name):
        if name == "timo":
            return Timo()
        elif name == "police":
            return Police()
        else:
            raise Exception("此英雄不在英雄工厂中")

hero_factory = Hero_factory()
t = hero_factory.create_hero("timo")
p = hero_factory.create_hero("police")

#女警调用fight方法和speak_lines方法
p.fight(t.hp,t.power)
p.speak_lines(p.name)

#提莫调用fight方法和speak_lines方法
t.fight(p.hp,p.power)
t.speak_lines(t.name)




